Skip to content

Fix syntaxError with using namespace ::std (f'up to #8454)#6100

Merged
chrchr-github merged 1 commit intocppcheck-opensource:mainfrom
chrchr-github:chr_usingstd
Mar 10, 2024
Merged

Fix syntaxError with using namespace ::std (f'up to #8454)#6100
chrchr-github merged 1 commit intocppcheck-opensource:mainfrom
chrchr-github:chr_usingstd

Conversation

@chrchr-github
Copy link
Copy Markdown
Collaborator

Why do %type% and %name% match keywords?

@firewave
Copy link
Copy Markdown
Collaborator

firewave commented Mar 8, 2024

Why do %type% and %name% match keywords?

Because we might have a bug. I vaguely remember something similar (I might be mistaken though). Maybe add some additional unit tests for that.

There's also https://trac.cppcheck.net/ticket/11169 which could be addressed along the way. Looking at the ticket it seems to explain the issue you are seeing...

@chrchr-github
Copy link
Copy Markdown
Collaborator Author

I bet we also have code that relies on the current behavior...

@firewave
Copy link
Copy Markdown
Collaborator

firewave commented Mar 8, 2024

I bet we also have code that relies on the current behavior...

For sure. Just makes things more interesting. The fun never ends...

But just having TODO testcases would be a start.

@chrchr-github
Copy link
Copy Markdown
Collaborator Author

Just changing %type% alone causes massive test failures all over the place.
The comments from Token::Match() are also hilarious:

     * - "%name%" any token which is a name, variable or type e.g. "hello" or "int"
     * - "%type%" Anything that can be a variable type, e.g. "int", but not "delete".

@firewave
Copy link
Copy Markdown
Collaborator

firewave commented Mar 8, 2024

TGIF

Copy link
Copy Markdown
Collaborator

@danmar danmar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@danmar
Copy link
Copy Markdown
Collaborator

danmar commented Mar 10, 2024

Why do %type% and %name% match keywords?

this is old decisions I don't even remember exactly. but in my head %name% is broad and I think it makes sense it matches keywords.

if we can make %type% more intuitive that is good.. I would not be strongly against that in theory. but well in practice I guess it breaks tons of code so let's be careful.

@chrchr-github chrchr-github merged commit f9f3fe0 into cppcheck-opensource:main Mar 10, 2024
@chrchr-github chrchr-github deleted the chr_usingstd branch March 10, 2024 21:12
@firewave
Copy link
Copy Markdown
Collaborator

if we can make %type% more intuitive that is good.. I would not be strongly against that in theory. but well in practice I guess it breaks tons of code so let's be careful.

We could introduce some debug or internal checks to try to get a hold on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants